﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
using Server.App_Data;

namespace Server
{
    // REMARQUE : vous pouvez utiliser la commande Renommer du menu Refactoriser pour changer le nom d'interface "IService1" à la fois dans le code et le fichier de configuration.
    [ServiceContract]
    public interface IService
    {
        #region User

        /// <summary>
        /// test comm
        /// </summary>
        /// <param name="email"></param>
        /// <param name="password"></param>
        /// <param name="question"></param>
        /// <param name="answer"></param>
        /// <returns></returns>
        [OperationContract]
        bool RegisterUser(string email, string password, string question, string answer);

        [OperationContract]
        bool EmailExists(string email);

        [OperationContract]
        bool IsUserExists(string email, string password);

        [OperationContract]
        string Connect(String email, String password);

        #endregion
        
        #region Feed

        [OperationContract]
        void AddFeed(string title, string description, string link, string pubDate, string LastBuildDate, string category, string username);

        [OperationContract]
        List<string> GetAllUserFeed(string email);

        [OperationContract]
        List<string> GetAllUserFeedByCategory(string email, string category);

        [OperationContract]
        List<string> GetUserSenderFeeds(string email);

        [OperationContract]
        List<string> GetUserReceiverFeeds(string email);

        [OperationContract]
        List<string> GetAllFeeds();

        [OperationContract]
        bool IsFeedRead(string fieldTitle, string email);

        [OperationContract]
        bool SetReadFeedState(string fieldTitle, string email);

        #endregion
        
        #region UserFeed

        [OperationContract]
        void ShareFeed(User sender, User addressee, Feed feedToShare);

        #endregion


        // TODO: ajoutez vos opérations de service ici
    }


    // Utilisez un contrat de données comme indiqué dans l'exemple ci-après pour ajouter les types composites aux opérations de service.
    [DataContract]
    public class CompositeType
    {
        bool boolValue = true;
        string stringValue = "Hello ";

        [DataMember]
        public bool BoolValue
        {
            get { return boolValue; }
            set { boolValue = value; }
        }

        [DataMember]
        public string StringValue
        {
            get { return stringValue; }
            set { stringValue = value; }
        }
    }
}
